package geowiki.utils;

public class WikipediaUtils {

	public static final String LANG_GERMAN = "de";
	public static final String LANG_ENGLISH = "en";
	public static final String DEFAULT_LANG = LANG_GERMAN;

	/**
	 * Returns the full URL for an (existing) Wikipedia article.
	 * 
	 * @param articleName
	 *            The name of the article.
	 * @return The URL to access the article.
	 */
	public static String getWikipediaArticleURL(String articleName) {
		return getWikipediaArticleURL(articleName, DEFAULT_LANG);
	}

	/**
	 * Returns the full URL for an (existing) Wikipedia article.
	 * 
	 * @param articleName
	 *            The name of the article.
	 * @param language
	 *            The language of Wikipedia to use.
	 * @return The URL to access the article.
	 */
	public static String getWikipediaArticleURL(String articleName, String language) {
		return "http://" + language + ".wikipedia.org/wiki/" + articleName;
	}

	/**
	 * Returns full link path from Wikipedia link.
	 * 
	 * @param link
	 * @param language
	 * @return
	 */
	public static String getFullURLFromLink(String wikiLink) {
		return getFullURLFromLink(wikiLink, DEFAULT_LANG);
	}

	public static String getFullURLFromLink(String wikiLink, String language) {
		return "http://" + language + ".wikipedia.org" + wikiLink;
	}
}
